10 TEXT:HOME
20 PRINT CHR$(4);"PR#3"

22 HOME
23 DIM B(20,80)
24 DIM C(1600)

25 DIM W(1,80)

26 X1=10:Y1=42:X9=10:Y9=40:V8=10:V9=38:BB=0:LL=0:O1=0:C6=0:G1=0:MA=0

27 FOR I=1 TO 8
28 M(I)=I
29 NEXT I

32 RDS=648

39 NORMAL:HOME:ONERR GOTO 22200

44 VTAB 10:HTAB 40:PRINT " "
45 VTAB 10:HTAB 40:PRINT "M"
50 INVERSE:VTAB 10:HTAB 42:PRINT "$":NORMAL
52 VTAB 20:HTAB 6:PRINT"Y":VTAB 20:HTAB 10:PRINT"I":VTAB 20:HTAB 15:PRINT"R - RUN":VTAB 20:HTAB 25:PRINT"S - SAVE MAZE":VTAB 20:HTAB 66:PRINT"DOLLAR :    0"
54 VTAB 21 :HTAB 5:PRINT"G H":VTAB 21:HTAB 9:PRINT"J K":VTAB 21:HTAB 25:PRINT"L - LOAD MAZE":VTAB 21:HTAB 42:PRINT"X - CATALOG":VTAB 21:HTAB 55:PRINT"O - HELP":VTAB 21:HTAB 66:PRINT"  STEP :    0"
56 VTAB 22 :HTAB 6:PRINT"B":VTAB 22:HTAB 10:PRINT"M":VTAB 22:HTAB 15:PRINT"Q - QUIT":VTAB 22:HTAB 25:PRINT"C - CLEAR SCN":VTAB 22:HTAB 42:PRINT"U - CLEAR ROUTE":VTAB 22:HTAB 66:PRINT"RESTEP :    0"

58 INVERSE:VTAB 23:HTAB 1:PRINT"                                                                               ":NORMAL

59 GOSUB 1200

60 NO=0:R1=0

61 INVERSE:VTAB 23:HTAB 50:PRINT"COMMON MODE     ":NORMAL

62 IF V8=10 AND V9=38 AND G1=0 THEN 64

63 IF G1>0 THEN INVERSE:VTAB 23:HTAB 50:PRINT"TARGET MODE     ":NORMAL:VTAB V8:HTAB V9:PRINT"T"


64 IF MA=1 THEN NORMAL:VTAB 23:HTAB 45:PRINT"SET"
65 IF MA=0 THEN NORMAL:VTAB 23:HTAB 45:PRINT"RND"

66 VTAB X9:HTAB Y9:PRINT"M":INVERSE:VTAB X1:HTAB Y1:PRINT"$":VTAB 23:HTAB 1:PRINT"COMMAND :                                   ":VTAB 23:HTAB 15:PRINT T$:NORMAL


100 REM GOSUB 6000


106 F$="PUZZLE-HOUSE":GOSUB 15120:GOSUB 6000:GOSUB 300
108 VTAB X9:HTAB Y9:PRINT"M":INVERSE:VTAB X1:HTAB Y1:PRINT"$":VTAB 23:HTAB 1:PRINT"COMMAND :                                   ":VTAB 23:HTAB 15:PRINT T$:NORMAL
110 FOR I=1 TO 50000:NEXT I

112 GOSUB 61000

116 F$="TUBE-CONNECT":GOSUB 15120:GOSUB 6000:GOSUB 300
117 VTAB X9:HTAB Y9:PRINT"M":INVERSE:VTAB X1:HTAB Y1:PRINT"$":VTAB 23:HTAB 1:PRINT"COMMAND :                                   ":VTAB 23:HTAB 15:PRINT T$:NORMAL
118 FOR I=1 TO 50000:NEXT I

119 GOSUB 61000

120 F$="M3":GOSUB 15120:GOSUB 6000:GOSUB 300
121 VTAB X9:HTAB Y9:PRINT"M":INVERSE:VTAB X1:HTAB Y1:PRINT"$":VTAB 23:HTAB 1:PRINT"COMMAND :                                   ":VTAB 23:HTAB 15:PRINT T$:NORMAL
122 FOR I=1 TO 50000:NEXT I

128 GOSUB 61000

130 F$="FOOD IS HERE":GOSUB 15120:GOSUB 6000:GOSUB 300
131 VTAB X9:HTAB Y9:PRINT"M":INVERSE:VTAB X1:HTAB Y1:PRINT"$":VTAB 23:HTAB 1:PRINT"COMMAND :                                   ":VTAB 23:HTAB 15:PRINT T$:NORMAL
132 FOR I=1 TO 50000:NEXT I

138 GOSUB 61000


210 RDS=RDS+12
220 IF RDS>3000 THEN RDS=1+(RDS-3000)
222 GOTO 60



300 X4=X9:Y4=Y9:I1=1:S1=0:H2=0
301 VTAB 20:HTAB 44:PRINT"                ":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0":INVERSE:VTAB 23:HTAB 66:PRINT"             ":NORMAL

302 INVERSE:VTAB 23:HTAB 1:PRINT"              RUNNING                       ":NORMAL

307 GOSUB 26000

308 IF G1>0 THEN GOSUB 40000

310 IF B(X9,Y9)=1 THEN B(X9,Y9)=0:VTAB X9:HTAB Y9:PRINT"M":BB=BB-1:GOSUB 1200


312 IF B(V8,V9)=1 AND G1>0 THEN B(V8,V9)=0:VTAB V8:HTAB V9:PRINT"T":BB=BB-1:GOSUB 1200 

314 IF B(X9,Y9+1)=1 AND B(X9+1,Y9+1)=1 AND B(X9+1,Y9)=1 AND B(X9+1,Y9-1)=1 AND B(X9,Y9-1)=1 AND B(X9-1,Y9-1)=1 AND B(X9-1,Y9)=1 AND B(X9-1,Y9+1)=1 THEN INVERSE:VTAB 20:HTAB 44:PRINT"NO EXIT":NORMAL:GOTO 60


315 VTAB X4:HTAB Y4:PRINT"M"
320 X5=X4:Y5=Y4
325 FOR I8=1 TO 8
330 IF M(I8)=4 AND B(X4+1,Y4-1)=0 THEN XX=X4+1:YY=Y4-1:Q=5:F1=1:GOTO 530
340 IF M(I8)=3 AND B(X4+1,Y4)=0 THEN XX=X4+1:YY=Y4:Q=4:F1=2:GOTO 530
350 IF M(I8)=2 AND B(X4+1,Y4+1)=0 THEN XX=X4+1:YY=Y4+1:Q=6:F1=3:GOTO 530
360 IF M(I8)=1 AND B(X4,Y4+1)=0 THEN XX=X4:YY=Y4+1:Q=3:F1=4:GOTO 530
370 IF M(I8)=8 AND B(X4-1,Y4+1)=0 THEN XX=X4-1:YY=Y4+1:Q=7:F1=5:GOTO 530
380 IF M(I8)=7 AND B(X4-1,Y4)=0 THEN XX=X4-1:YY=Y4:Q=2:F1=6:GOTO 530
390 IF M(I8)=6 AND B(X4-1,Y4-1)=0 THEN XX=X4-1:YY=Y4-1:Q=8:F1=7:GOTO 530
395 IF M(I8)=5 AND B(X4,Y4-1)=0 THEN XX=X4:YY=Y4-1:Q=1:F1=8:GOTO 530
398 NEXT I8
400 I1=I1-1:IF I1<1 THEN I1=1
410 A7=C(I1):C(I1)=23:H2=H2+1:N1=22:N2=78:GOSUB 900
420 IF A7=1 THEN YY=Y4+1:XX=X4
430 IF A7=4 THEN XX=X4-1:YY=Y4
440 IF A7=3 THEN YY=Y4-1:XX=X4
450 IF A7=2 THEN XX=X4+1:YY=Y4
460 IF A7=5 THEN XX=X4-1:YY=Y4+1
470 IF A7=6 THEN XX=X4-1:YY=Y4-1
480 IF A7=7 THEN XX=X4+1:YY=Y4-1
490 IF A7=8 THEN XX=X4+1:YY=Y4+1
500 GOTO 550
530 IF B(XX,YY)=2 THEN XX=X4:YY=Y4:ON F1 GOTO 340,350,360,370,380,390,395,400
540 C(I1)=Q:I1=I1+1
550 VTAB X4:HTAB Y4:PRINT" ":B(XX,YY)=2 

552 IF G1>0 AND XX=V8 AND YY=V9 THEN VTAB X5:HTAB Y5:PRINT" ":GOSUB 27000:S1=0:H2=0:GOTO 650


560 IF XX>19 OR XX<1 OR YY>79 OR YY<1 THEN VTAB X5:HTAB Y5:PRINT" ":GOSUB 27000:S1=0:H2=0:GOTO 650
570 X4=XX:Y4=YY:VTAB X4:HTAB Y4:PRINT"M":VTAB X5:HTAB Y5:PRINT" "
575 IF XX=X9 AND YY=Y9 THEN R1=R1+1:GOSUB 28000
577 IF R1>8 THEN R1=0:NO=1:INVERSE:VTAB 20:HTAB 44:PRINT"NO EXIT":NORMAL:GOTO 650
580 S1=S1+1:N1=21:N2=78
590 IF S1>9 THEN N2=N2-1
600 IF S1>99 THEN N2=N2-1
610 IF S1>999 THEN N2=N2-1
620 VTAB N1:HTAB N2: PRINT S1
640 GOTO 315

650 INVERSE:VTAB 23:HTAB 1:PRINT"              WAITING                       ":NORMAL
660 FOR I=0 TO 20
670 FOR J=0 TO 80
680 IF B(I,J)<>1 THEN B(I,J)=0
690 NEXT J
700 NEXT I
705 INVERSE:VTAB 23:HTAB 15:PRINT"        ":NORMAL
710 IF NO=1 THEN NO=0:RETURN
720 INVERSE:VTAB 20:HTAB 44:PRINT"SHORTCUT":NORMAL
730 X7=X9:Y7=Y9:I2=1:CUT=0
740 IF C(I2)=5 THEN X8=X7+1:Y8=Y7-1
750 IF C(I2)=4 THEN X8=X7+1:Y8=Y7
760 IF C(I2)=6 THEN X8=X7+1:Y8=Y7+1
770 IF C(I2)=3 THEN X8=X7:Y8=Y7+1
780 IF C(I2)=7 THEN X8=X7-1:Y8=Y7+1
790 IF C(I2)=2 THEN X8=X7-1:Y8=Y7
792 IF C(I2)=8 THEN X8=X7-1:Y8=Y7-1 
794 IF C(I2)=1 THEN X8=X7:Y8=Y7-1

795 IF G1>0 AND X8=V8 AND Y8=V9 THEN INVERSE:VTAB X7:HTAB Y7:PRINT" ":NORMAL:CUT=CUT+1:VTAB 20:HTAB 54:PRINT CUT:RETURN


796 IF X8>19 OR X8<1 OR Y8>79 OR Y8<1 THEN INVERSE:VTAB X7:HTAB Y7:PRINT" ":NORMAL:CUT=CUT+1:VTAB 20:HTAB 54:PRINT CUT:RETURN
800 VTAB X8:HTAB Y8:PRINT"M":INVERSE:VTAB X7:HTAB Y7:PRINT" ":NORMAL:CUT=CUT+1:VTAB 20:HTAB 54:PRINT CUT:X7=X8:Y7=Y8
810 I2=I2+1
880 GOTO 740

900 IF H2>9 THEN N2=N2-1
910 IF H2>99 THEN N2=N2-1
920 IF H2>999 THEN N2=N2-1
930 VTAB N1:HTAB N2: PRINT H2
940 RETURN

1000 IF X2<1 THEN X2=19
1010 IF X2>19 THEN X2=1
1020 IF Y2<1 THEN Y2=79
1030 IF Y2>79 THEN Y2=1
1040 RETURN

1100 IF B(X1,Y1)=0 THEN BB=BB+1
1110 RETURN 

1150 IF B(X1,Y1)=1 THEN BB=BB-1
1160 RETURN

1200 IF BB<0 THEN BB=0
1210 IF BB<10 AND BB>-1 THEN NN1=78
1220 IF BB<100 AND BB>9 THEN NN1=77
1230 IF BB<1000 AND BB>99 THEN NN1=76
1240 IF BB<10000 AND BB>999 THEN NN1=75
1250 VTAB 20:HTAB 75:PRINT"    "
1260 VTAB 20:HTAB NN1:PRINT BB
1270 RETURN


6000 IF MA=1 THEN 300

6001 T$=""


6002 VTAB 21:HTAB 15:PRINT"E - ECHO"
6005 C6=C6+1

6030 INVERSE:VTAB 23:HTAB 1:PRINT"              WAITING                       ":NORMAL

6040 FOR I=1 TO RDS
6050 SF=INT(RND(999)*8+1):SG=INT(RND(999)*8+1)
6060 TG=M(SF):M(SF)=M(SG):M(SG)=TG
6070 NEXT I

6080 FOR I=1 TO 8
6090 S(I)=M(I)
6095 NEXT I


6100 GOSUB 46100


6298 RETURN

6300 IF MA=1 THEN 300

6301 T$=""




6302 FOR I=1 TO 8
6310 M(I)=S(I)
6320 NEXT I

6322 GOSUB 46100



6330 GOTO 300

9000 HOME:PRINT CHR$(4);"CATALOG"+",D1,S6":END

 


15100 INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":VTAB 23:HTAB 1:INPUT"FILENAME : ";F$:NORMAL
15105 INVERSE:VTAB 23:HTAB 50:PRINT"LOADING":NORMAL
15106 IF F$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 60

15108 REM 

15110 REM PRINT CHR$(4);"OPEN";F$
15120 PRINT CHR$(4);"READ";F$ 
15130 FOR I=1 TO 19
15140 FOR J=1 TO 79
15150 INPUT B(I,J)
15160 NEXT J
15170 NEXT I
15180 PRINT CHR$(4);"CLOSE";F$
15181 REM PRINT CHR$(4);"OPEN";F$+".INDEX"
15182 PRINT CHR$(4);"READ";F$+".INDEX"
15183 INPUT X1:INPUT Y1:INPUT X9:INPUT Y9:INPUT V8:INPUT V9:INPUT G1:INPUT M(1):INPUT M(2):INPUT M(3):INPUT M(4):INPUT M(5):INPUT M(6):INPUT M(7):INPUT M(8):INPUT T$:INPUT MA
15184 PRINT CHR$(4);"CLOSE";F$+".INDEX"
15185 INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL
15186 GOSUB 15200

15187 IF G1>0 THEN INVERSE:VTAB 23:HTAB 50:PRINT"TARGET MODE     ":NORMAL
15188 IF G1=0 THEN RN=1:GOSUB 41000


15189 NORMAL:VTAB 20:HTAB 44:PRINT"                "

15190 IF MA=1 THEN C6=0:NORMAL:VTAB 21:HTAB 15:PRINT"        "

15191 IF MA=0 THEN C6=C6+1:FOR I=1 TO 8:S(I)=M(I):NEXT I:VTAB 21:HTAB 15:PRINT"E - ECHO"

15192 LL=1

15193 GOSUB 1200

15194 RETURN

15200 BB=0:VTAB 20:HTAB 75:PRINT"    ":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0" 
15202 FOR I=1 TO 19
15210 FOR J=1 TO 79
15220 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$":BB=BB+1:GOSUB 1200
15222 IF B(I,J)<>1 THEN VTAB I:HTAB J:PRINT" "
15230 NEXT J
15240 NEXT I
15250 RETURN

15500 NORMAL:VTAB 20:HTAB 44:PRINT"                ":INVERSE:VTAB 23:HTAB 66:PRINT"             ":NORMAL

15502 FOR I=1 TO 19
15510 FOR J=1 TO 79
15520 VTAB I:HTAB J:PRINT" "
15530 NEXT J
15540 NEXT I

15542 FOR I=0 TO 20
15543 FOR J=0 TO 80
15544 B(I,J)=0
15545 NEXT J
15546 NEXT I

15548 BB=0
15549 VTAB 20:HTAB 75:PRINT"   0":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0"
15550 GOTO 60


15800 HOME
15802 PRINT CHR$(4);"CATALOG"+",D2,S6"
15810 PRINT:PRINT"<PRESS ANY KEY TO BE CONTINUE>":NORMAL:GET CT$:PRINT CT$
15820 HOME:BB=0
15830 FOR I=1 TO 19
15840 FOR J=1 TO 79
15850 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$":BB=BB+1
15860 NEXT J
15870 NEXT I

15880 IF D2=1 THEN D2=0:RETURN

15990 GOTO 52


18000 HOME
18006 GOSUB 20040
18820 HOME:BB=0
18830 FOR I=1 TO 19
18840 FOR J=1 TO 79
18850 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$":BB=BB+1
18860 NEXT J
18870 NEXT I
18990 GOTO 52


 

21000 FOR I=1 TO 19
21010 FOR J=1 TO 79
21020 IF B(I,J)<>1 THEN VTAB I:HTAB J:PRINT" "
21030 NEXT J
21040 NEXT I
21050 RETURN

22200 INVERSE:VTAB 23:HTAB 50:PRINT"ERROR OCCURED":NORMAL:FOR I=1 TO 50000:NEXT I:GOTO 60
 

26000 NORMAL
26002 FOR I=1 TO 19
26010 FOR J=1 TO 79
26020 IF B(I,J)<>1 THEN VTAB I:HTAB J:PRINT" "
26030 NEXT J
26040 NEXT I
26050 RETURN

27000 S1=S1+1:N1=21:N2=78
27010 IF S1>9 THEN N2=N2-1
27020 IF S1>99 THEN N2=N2-1
27030 IF S1>999 THEN N2=N2-1
27040 VTAB N1:HTAB N2: PRINT S1
27050 RETURN

28000 IF R1>8 THEN RETURN
28010 INVERSE:VTAB 23:HTAB 66:PRINT"ROOT PASS : ";R1:NORMAL
28020 RETURN

29000 IF X1=X9 AND Y1=Y9 THEN 29040
29010 IF B(X1,Y1)=1 THEN NORMAL:VTAB X1:HTAB Y1:PRINT"$"
29020 IF B(X1,Y1)=0 THEN NORMAL:VTAB X1:HTAB Y1:PRINT" "
29030 IF X2=X9 AND Y2=Y9 THEN 29050
29040 INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
 

29050 RETURN

 


40000 NORMAL:VTAB V8:HTAB V9:PRINT"T"

40002 FOR I=0 TO 80

40010 B(0,I)=1:B(20,I)=1
40020 NEXT I

40030 FOR J=0 TO 20
40040 B(J,0)=1:B(J,80)=1
40050 NEXT J


40090 RETURN

41000 IF RN=1 THEN 41006

41001 IF B(V8,V9)=1 THEN B(V8,V9)=0:BB=BB-1:GOSUB 1200 

41002 NORMAL:VTAB V8:HTAB V9:PRINT" ":G1=0:V8=10:V9=38

41006 INVERSE:VTAB 23:HTAB 50:PRINT"COMMON MODE     ":NORMAL

41008 FOR I=0 TO 80


41010 B(0,I)=0:B(20,I)=0
41020 NEXT I

41030 FOR J=0 TO 20
41040 B(J,0)=0:B(J,80)=0
41050 NEXT J
41060 IF RN=1 THEN RN=0:RETURN

41090 GOTO 64
 
42000 ONERR GOTO 42002
42002 INVERSE:VTAB 23:HTAB 1:PRINT"                                                                               ":VTAB 23:HTAB 1:INPUT"INPUT A NUMBER BETWEEN 1 TO 99999 : ";RDS:NORMAL
42006 IF RDS<1 OR RDS>99999 THEN 42002
42008 ONERR GOTO 22200
42010 GOTO 60

 


46100 FOR I=1 TO 8
46102 IF M(I)=1 THEN P$(I)="R "
46104 NEXT I
46110 FOR I=1 TO 8
46112 IF M(I)=2 THEN P$(I)="DR "
46114 NEXT I
46120 FOR I=1 TO 8
46122 IF M(I)=3 THEN P$(I)="D "
46124 NEXT I
46130 FOR I=1 TO 8
46132 IF M(I)=4 THEN P$(I)="DL "
46134 NEXT I
46140 FOR I=1 TO 8
46142 IF M(I)=5 THEN P$(I)="L "
46144 NEXT I
46150 FOR I=1 TO 8
46152 IF M(I)=6 THEN P$(I)="UL "
46154 NEXT I
46160 FOR I=1 TO 8
46162 IF M(I)=7 THEN P$(I)="U "
46164 NEXT I
46170 FOR I=1 TO 8
46172 IF M(I)=8 THEN P$(I)="UR "
46174 NEXT I

46200 FOR I=1 TO 8
46202 T$=T$+P$(I)+" "
46206 NEXT I


46300 RETURN


 

60000 IF A$=CHR$(10) OR A$=CHR$(13) OR A$=CHR$(22) OR A$=CHR$(12) OR A$=CHR$(11) OR A$=CHR$(17) OR A$=CHR$(23) OR A$=CHR$(21) OR A$=CHR$(27) OR A$=CHR$(3) THEN A$=" "
60002 RETURN



61000 VTAB 21 :HTAB 5:PRINT"G H":VTAB 21:HTAB 9:PRINT"J K":VTAB 21:HTAB 25:PRINT"L - LOAD MAZE":VTAB 21:HTAB 42:PRINT"X - CATALOG":VTAB 21:HTAB 55:PRINT"O - HELP":VTAB 21:HTAB 66:PRINT"  STEP :    0"
61010 VTAB 22 :HTAB 6:PRINT"B":VTAB 22:HTAB 10:PRINT"M":VTAB 22:HTAB 15:PRINT"Q - QUIT":VTAB 22:HTAB 25:PRINT"C - CLEAR SCN":VTAB 22:HTAB 42:PRINT"U - CLEAR ROUTE":VTAB 22:HTAB 66:PRINT"RESTEP :    0"

61020 INVERSE:VTAB 23:HTAB 1:PRINT"                                                                               ":NORMAL

61030 RETURN

   